import { string } from 'vue-types';
import { BasicColumn } from '/@/components/Table';
import { toTimezone } from '/@/utils/dateUtil';
import { useI18n } from '/@/hooks/web/useI18n';

const { t } = useI18n();
export const columnsValid: BasicColumn[] = [
  {
    title: 'id',
    dataIndex: 'id',
    ifShow: false,
  },
  {
    title: t('business.common_level'),
    dataIndex: 'level',
    width: 80,
    slots: { customRender: 'level' },
  },
  {
    title: t('table.system.system_valid_unit'),
    titleHelpPlacement: 'top',
    helpMessage: `<p>${t('table.system.system_unit_tip1')}<p><p>${t(
      'table.member.member_according',
    )}<span style="color:#F59A23;">${t('table.member.member_ratae_detail')}</span>${t(
      'table.member.member_computed_',
    )}</p>`,
    dataIndex: 'effective_amount',
    editRow: true,
    editComponent: 'InputNumber',
    editComponentProps: {
      max: 9999999999.99,
    },
    // editRule: async (text) => {
    //   if (!text) {
    //     return '有效投注不能为空';
    //   } else if (text == '0') {
    //     return '有效投注不能为0';
    //   } else if (text < '0') {
    //     return '有效投注不能小于0';
    //   }
    //   return '';
    // },
    //key: 'customTitle',
  },
  {
    title: t('table.system.system_rebate_rate'),
    dataIndex: 'rebate_ratio',
    editRow: true,
    editComponent: 'InputNumber',
    // editRule: async (text) => {
    //   if (!text) {
    //     return '返佣比例不能为空';
    //   } else if (parseFloat(text) < 0 || parseFloat(text) >= 100) {
    //     return '返佣比例0到100';
    //   }
    //   return '';
    // },
  },
  {
    title: t('business.common_update_time'),
    dataIndex: 'updated_at',
    customRender: ({ record }) => {
      return toTimezone(record.updated_at);
    },
  },
  {
    title: t('table.risk.report_operate_people'),
    dataIndex: 'updated_by',
  },
];

export const columnsCondition: BasicColumn[] = [
  {
    title: 'ID',
    dataIndex: 'id',
    ifShow: false,
  },
  {
    title: t('table.system.system_condition'),
    dataIndex: 'condition',
    minWidth: 200,
  },
  {
    title: t('table.system.system_config_amount'),
    editRow: true,
    dataIndex: 'config_amount',
    editComponent: 'InputNumber',
    editComponentProps: {
      max: 9999999999.99,
    },
    // editRule: async (text) => {
    //   if (!text) {
    //     return '配置金额不能为空';
    //   } else if (text == '0') {
    //     return '配置金额不能为0';
    //   } else if (text < '0') {
    //     return '配置金额不能小于0';
    //   }
    //   return '';
    // },
  },
  {
    title: t('business.common_update_time'),
    dataIndex: 'updataTime',
    customRender: ({ record }) => {
      return toTimezone(record.updataTime);
    },
  },
  {
    title: t('table.risk.report_operate_people'),
    dataIndex: 'oparation_people',
  },
];
// useAutoTableLabelWidth(columnsCondition, true);
interface DataListType1 {
  level: number;
  valid: number;
  rebate: number;
  updataTime: string;
  oparation_people: string;
}
interface DataListType2 {
  // configAmount: string;
  condition: string;
  updataTime: string;
  oparation_people: string;
  type: number;
  config_amount: string;
}
export const columnsValidData: DataListType1[] = [
  {
    level: 1,
    valid: 1000,
    rebate: 88888,
    updataTime: '2023-08-12',
    oparation_people: 'admin',
  },
];

export const columnsConditionData: DataListType2[] = [
  {
    condition: t('table.system.system_week_valid'),
    config_amount: '0',
    type: 1,
    updataTime: '',
    oparation_people: '-',
  },
  {
    condition: t('table.system.system_week_deposit'),
    config_amount: '0',
    updataTime: '',
    type: 2,
    oparation_people: '-',
  },
];

export const list = [
  {
    id: '162821722372111080',
    commission_id: '162821338246176188',
    type: 1,
    config_amount: '45.00',
    updated_by: 'migo1223',
    updated_at: 1699087981,
    uid: '',
  },
];
//默认数据
export const defalutConditionData: DataListType2[] = [
  {
    condition: t('table.system.system_week_valid'),
    config_amount: '0',
    type: 1,
    updataTime: '',
    oparation_people: '-',
  },
  {
    condition: t('table.system.system_week_deposit'),
    config_amount: '0',
    updataTime: '',
    type: 2,
    oparation_people: '-',
  },
];
